#pragma once

#include "game_math.h"
#include <SDL.h>

//TODO: move all local constants out

//DEBUG_MODE is in game_math, figure out a way to bring it here, same with GRPAHICS_DEBUG_MODE
#define GLOBAL_CONSTANT const
#define LOCAL_CONSTANT const
#define LOG_ERROR(msg) {printf("ERROR: %s",msg);}
#define ERROR(msg)

//if true, application is quitting
typedef bool BOOL_QUIT;

//time
typedef float TIME_MS_float;
typedef float TIME_SEC_float;
typedef Uint64 TIME_MS_int;
typedef int TIME_SEC_int;

//positions

typedef V2i POS_REL_V2i;
typedef V2i POS_ABS_V2i;
typedef V2 POS_REL_V2;
typedef V2 POS_ABS_V2;

//items
typedef Uint8 ITEM_TypeId_int;
typedef Uint8 ITEM_Amount_int;

/*
typedef Uint8 uint8;
typedef Uint16 uint16;
typedef Uint32 uint32;
typedef Uint64 uint64;

typedef Sint8 int8;
typedef Sint16 int16;
typedef Sint32 int32;
typedef Sint64 int64;

typedef float real;
typedef double precise_real;
*/

/*	1 is true
	0 is false
	-1 is unknown*/
/*
typedef Uint8 boolean;
#define BOOLEAN_UNKNOWN (-1)
*/

namespace G
{

	GLOBAL_CONSTANT int SCREEN_WIDTH = 400;
	GLOBAL_CONSTANT int SCREEN_HEIGHT = 300;
	GLOBAL_CONSTANT int UINT8_MAX  = 0xff;
	GLOBAL_CONSTANT int GRAPHICS_TILE_SIZE = 16;
	GLOBAL_CONSTANT int TILES_IN_CHUNK =12;
	GLOBAL_CONSTANT int CHUNK_COUNT =12;
	
	
	//GLOBAL_CONSTANT int CHUNKS_PER_SCREEN = (int)((float)G::SCREEN_WIDTH/(float)(G::GRAPHICS_TILE_SIZE* G::TILES_IN_CHUNK));
	GLOBAL_CONSTANT int CHUNK_SIZE_PIXELS = TILES_IN_CHUNK * GRAPHICS_TILE_SIZE;
	GLOBAL_CONSTANT V2i CHUNKS_PER_SCREEN = v2i(G::SCREEN_WIDTH / G::CHUNK_SIZE_PIXELS,
												G::SCREEN_HEIGHT / G::CHUNK_SIZE_PIXELS);
	GLOBAL_CONSTANT int SCREEN_DEBUG_EXTRA_PIXELS = 200;
	GLOBAL_CONSTANT V2i GRAPHICS_RENDERWINDOW_TOP_LEFT = {G::SCREEN_DEBUG_EXTRA_PIXELS,G::SCREEN_DEBUG_EXTRA_PIXELS};
	//max seconds between frames
	GLOBAL_CONSTANT TIME_SEC_float GAME_DT_CAP = 0.120f;	
}